package cn.qyd;

import java.util.concurrent.atomic.AtomicInteger;

/**
 * @author 邱运铎
 * 调整jvm栈的大小为256k,默认1024k-Xss256k
 *
 * java -XX:+PrintFlagsFinal -version | grep ThreadStackSize 查看JVM栈的默认大小
 * @date 2024-03-08 14:59
 */
public class StackOutMemoryDemo {
    private static AtomicInteger count = new AtomicInteger(0);

    public static void main(String[] args) {
        while (true) {
            testStackOverFlowError();
        }
    }

    public static void testStackOverFlowError() {
        System.out.println(count.incrementAndGet());
        testStackOverFlowError();
    }
}
